
<!DOCTYPE html>
<html class="x-admin-sm">
    <head>
        <meta charset="UTF-8">
        <title>系统日志</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="./css/font.css">
        <link rel="stylesheet" href="./css/index.css">
        <script src="./lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="./js/index.js"></script>
    
    </head>
    <style>
    	.layui-table th,td{
    		text-align: center;
    	}
    	
    </style>
    <body>
        <div class="x-nav">
          <span class="layui-breadcrumb">
            <a >首页</a>
            <a >演示</a>
            <a>
              <cite>导航元素</cite></a>
          </span>
          <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
            <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
        </div>
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body ">
                                                     
                               <div class="layui-input-inline layui-show-xs-block">
                            <input class="layui-input" placeholder="开始日" name="start" id="start"></div>
                        <div class="layui-input-inline layui-show-xs-block">
                            <input class="layui-input" placeholder="截止日" name="end" id="end"></div>

                        <div class="layui-input-inline layui-show-xs-block" onclick="selects()">
                            <button class="layui-btn" lay-submit="" lay-filter="sreach">
                                <i class="layui-icon">&#xe615;</i></button>
                        </div>
                           
                        </div>
                       
                        <div class="layui-card-body ">
                            <table class="layui-table layui-form">
                              <thead>
                                <tr>
                                  
                                  <th>ID</th>
                                  <th>内容</th>  
                                   <th>发起人</th> 
                                  <th>时间</th>                                                                  
                                  
                              </thead>
                              <tbody id="table">
                               
                                
                              </tbody>
                            </table>
                        </div>
                      
                    </div>
                </div>
            </div>
        </div> 
    </body>
    <script src="js/jquery.js"></script>
    <script type="application/javascript">
      selects();
   
    	//模糊查询
    	function selects(){
    		
    		$.ajax({
    			type:"get",
    			url:"http://localhost:16111/memurbac/selectjournal",
    			dataType:"json",  
    			
    			xhrFields:{withCredentials: true},
    			data:{
    				start:$('#start').val(),
    				end:$('#end').val()
    			},
    			success:function(res){
    				//表示为查询成功，
    				if(res.code==200){
    					//表格头部不去除
    					$("table tr:not(:first)").html("");
    					//将数据添加到table中
    					for(var i=0;i<res.data.length;i++){
    						   
    						  
                                 
			     var str="<tr>"+                                
	                      "<td>"+res.data[i].id+"</td>"+
	                      "<td>"+res.data[i].ulog_content+"</td>"+
	                      "<td>"+res.data[i].ulog_user+"</td>"+	
	                      "<td>"+formatDateTime(res.data[i].ulog_createtime)+"</td>"+	                                           	                     
	                      "</tr>"
		    	
      
        
  	
                      $('#table').html($('#table').html()+str);
   }
    					
    					        
    					
    				}else{
    					
    					layui.use("layer", function () {
                //提示错误信息
    					layer.msg(res.error,{icon:7,time:1000});
             })

    					
    				
    				}
    			},
    			error:function(error){
    			
    				layui.use("layer", function (){
             	//提示错误信息
    				layer.msg(JSON.stringify(error),{icon:2,time:1000});
             })
    				
    			}
    		});
   
    	}
    	
    	
      layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var form = layui.form;
        
        //执行一个laydate实例
        laydate.render({
          elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
          elem: '#end' //指定元素
        });
      });




/**
 * 时间转字符串的方法
 */
function formatDateTime(inputTime) {
    var date = new Date(inputTime);
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
    m = m < 10 ? ('0' + m) : m;
    var d = date.getDate();
    d = d < 10 ? ('0' + d) : d;
    var h = date.getHours();
    h = h < 10 ? ('0' + h) : h;
    var minute = date.getMinutes();
    var second = date.getSeconds();
    minute = minute < 10 ? ('0' + minute) : minute;
    second = second < 10 ? ('0' + second) : second;
    return y + ' 年 ' + m + ' 月 ' + d + ' 日 ' + h + ' : ' + minute + ' : ' + second;
}

    
    </script>
    
</html>